package core

import (
	"github.com/gin-gonic/gin/binding"
	"github.com/go-playground/locales/zh"
	ut "github.com/go-playground/universal-translator"
	"github.com/go-playground/validator/v10"
	chTranslations "github.com/go-playground/validator/v10/translations/zh"
)

func InitTrans() ut.Translator {
	trans, _ := ut.New(zh.New()).GetTranslator("zh")

	chTranslations.RegisterDefaultTranslations(binding.Validator.Engine().(*validator.Validate), trans)

	return trans
}